<template>
	<view class="app-pages">
		<view class="cell">
			<u-cell :border="false">
				<view class="" slot="title">成人登塔门票 ×1</view>
				<view class="" slot="label">
					<view class="label">
						<view class="label-item">
							<view class="label-item-name">使用日期</view>
							<view class="label-item-value">2022-08-08</view>
						</view>
						<view class="label-item">
							<view class="label-item-name">入塔时间</view>
							<view class="label-item-value">08:30-21:30</view>
						</view>
						<view class="label-item">
							<view class="label-item-name">地址</view>
							<view class="label-item-value">中央电视塔一层入塔检票处验证入园</view>
						</view>
					</view>
				</view>
			</u-cell>
		</view>
		<view class="cell qr">
			<view class="title">凭【二维码】直接入园</view>
			<canvas style="width: 300rpx;height: 300rpx;" canvas-id="logoQRCode" />
			<view class="footer">
				<text>机器猫</text>
				<text style="margin-left: 50rpx;">1101**********121</text>
			</view>
		</view>
	</view>
</template>
<script>
	import drawQrcode from '@/utils/weapp.qrcode.min.js'
	export default {
		data() {
			return {}
		},
		mounted() {
			uni.showLoading({
				title:'二维码生成中...'
			})
			drawQrcode({
				width: 150,
				height: 150,
				x: 0,
				y: 0,
				canvasId: 'logoQRCode',
				typeNumber: 5, //最大27
				text: 'www.baidu.com',
				background: '#FFFFFF', //二维码背景颜色，默认值白色
				foreground: '#000000', //二维码前景色，默认值黑色
				/*image:{ //二维码中间放图片
				  imageResource: '../../images/d.png',
				  dx: 70,
				  dy: 70,
				  dWidth: 60,
				  dHeight: 60
				},*/
				correctLevel: 2, //非必须，二维码纠错级别，默认值为高级，取值：{ L: 1, M: 0, Q: 3, H: 2 }
				callback(e) {
					uni.hideLoading();
					console.log('微信小程序二维码: ', e)
				}
			});
		},
		onLoad() {
		}
	}
</script>
<style lang="scss" scoped>
	.cell {
		margin-top: 50rpx;
		box-shadow: 0 0 4rpx #ccc;

		.label {
			padding: 20rpx 0 0 30rpx;
			font-size: 26rpx;

			.label-item {
				display: flex;

				&+.label-item {
					margin-top: 15rpx;
				}

				.label-item-name {
					width: 160rpx;
				}

				.label-item-value {
					color: #F59A23;
				}
			}
		}
	}

	.qr {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;

		.title {
			padding-top: 30rpx;
			padding-bottom: 50rpx;
		}

		.footer {
			padding-top: 50rpx;
			padding-bottom: 30rpx;
		}
	}
</style>
